using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;

namespace SpeedSCM.Module
{
    public partial class ActionPermissionController : ViewController
    {
        public ActionPermissionController()
        {
            InitializeComponent();
            RegisterActions(components);
        }

        private void ActionPermissionController_Activated(object sender, EventArgs e)
        {
            foreach (Controller controller in Frame.Controllers)
            {
                foreach (ActionBase action in controller.Actions)
                {
                    action.Enabled.SetItemValue("ActionPermission", SecuritySystem.IsGranted(new ActionAccessPermission(action.Id, DevExpress.ExpressApp.Security.ObjectAccessModifier.Allow)));
                }
            }
        }
    }
}
